home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2791 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.7 KB

  1. Path: news.cac.psu.edu!psuvm!cwf102
  2. Organization: Kyr's Condom Cantina
  3. X-Subliminal-Message: You want to buy my condoms...  :)
  4. Rationale: Hack and Slay!!
  5. Date: Fri, 19 Jan 1996 11:39:01 EST
  6. From: The Mighty Stymie <CWF102@psuvm.psu.edu>
  7. Message-ID: <96019.113901CWF102@psuvm.psu.edu>
  8. Newsgroups: comp.lang.c++
  9. Subject: Re: BORLAND C++ 4.5 wont add .1 and .9
  10. References: <1996Jan18.044900.10609@oasis.enmu.edu>
  11.  
  12. I believe your problem has something to do with the way Borland stroes floating
  13. point numbers.  I had a similar problem recently:
  14.  
  15. if(x>0.1)
  16.   do this
  17. else
  18.   do that
  19.  
  20. If x=0.1 it would still do "this" and it wouldn't do "that" until x<0.1
  21. I was only concerned with increments or decrements of 0.1, so I did this
  22.  
  23. if(x>0.11)
  24.   do this
  25. else
  26.   do that
  27.  
  28. If you tack on a digit beyond the on your concerned with, things may work.  As
  29. I finish this note, I forget what your problem was specifically, but I know it
  30. was similar to this. :)
  31. -christopher w. felter
  32.  
  33. *******************************************************************************
  34. * ____    __  __  ____ Christopher W. Felter  (alias: The Mighty Stymie)      *
  35. *  ---\    / /   /---  cwf102@psuvm.psu.edu       cwf102@email.psu.edu        *
  36. *   ---\  / /___/--    felt43@eetsg00.bd.psu.edu  stymie@psu.edu              *
  37. *       \/ /   /       http://metro.turnpike.net/S/stymie                     *
  38. *         /   /        "If I get home and there's sour cream on them, those   *
  39. *            /          food, my husband's gonna be pissed.  I said pissed!"  *
  40. *           /           - Overweight, midwestern woman at Taco Bell, Oxford,  *
  41. *                         Ohio (September 11, 1995)                           *
  42. *******************************************************************************
  43.